package com.zzsz.Controller;

import com.zzsz.common.core.controller.BaseController;
import com.zzsz.common.core.domain.AjaxResult;
import com.zzsz.common.core.page.TableDataInfo;
import com.zzsz.domain.ZzszInStockVO;
import com.zzsz.service.InStockService;
import com.zzsz.service.ProductsService;
import com.zzsz.system.domain.ZzszProducts;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zzsz.common.utils.PageUtils.startPage;

/**
 * @Classname ProductController
 * @Description
 * @Date 2025/9/5 9:10
 * @Created by SYL
 */
@Slf4j
@RequestMapping("/products")
@RestController
public class ProductController extends BaseController {
    @Autowired
    private InStockService inStockService;
    @Autowired
    private ProductsService productsService;

    /**
     * 商品入库列表
     * @return
     */
    @GetMapping("/instock/list")
    public TableDataInfo getinStockList(ZzszInStockVO zzszInStockVO) {
        startPage();
        log.info("执行getinStockList 搜索参数:{}",zzszInStockVO);
         List<ZzszInStockVO> list= inStockService.getinStockList(zzszInStockVO);
        log.info("执行list 返回结果:{}",list);
        return getDataTable(list);
    }

    @GetMapping("/list")
    public AjaxResult getproductsList(ZzszProducts ZzszProducts) {
        log.info("getproductsList 搜索参数:{}",ZzszProducts);
        List<ZzszProducts> list= productsService.getproductsList(ZzszProducts);
        log.info("执行list 返回结果:{}",list);
        return success(list);
    }
}
